import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Info here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Info extends Actor
{
    private GreenfootImage popupImage;
    private boolean isVisible;

    public Info(String title, String message) {
        popupImage = new GreenfootImage(400, 300);
        popupImage.setColor(Color.WHITE);
        popupImage.fill();
        popupImage.setColor(Color.BLACK);
        popupImage.drawRect(0, 0, 399, 299);
        popupImage.drawString(title, 20, 30);
        popupImage.drawString(message, 20, 60);
        setImage(popupImage);
        isVisible = true;
    }

    public void act() {
        if (Greenfoot.mouseClicked(this)) {
            getWorld().removeObject(this); // 关闭弹窗
        }
    }
}
